﻿using System;
using System.Drawing;
using System.Collections.Generic;

namespace ApiBetaSeries
{
    public interface IUser
    {
        /// <summary>
        /// Login of the member
        /// </summary>
         string Login { get; set; }
        /// <summary>
        /// date of the last cached data
        /// </summary>
         DateTime Cached { get; set; }
        /// <summary>
        /// Url to the avatar
        /// </summary>
         string UrlAvatar { get; set; }

        /// <summary>
        /// Avatar ot the member
        /// </summary>
         Bitmap Avatar { get; }
        /// <summary>
        /// number of shows followed
        /// </summary>
         int ShowNumber { get; set; }
        /// <summary>
        /// number of seasons
        /// </summary>
         int SeasonNumber { get; set; }
        /// <summary>
        /// number of episodes
        /// </summary>
         int EpisodeNumber { get; set; }
        /// <summary>
        /// general progress
        /// </summary>
         string Progress { get; set; }
        /// <summary>
        /// number of episodes to watch
        /// </summary>
         int EpisodeToWatch { get; set; }
        /// <summary>
        /// time spended watching shows
        /// </summary>
         TimeSpan TimeOnTv { get; set; }
        /// <summary>
        /// remaining time to spend
        /// </summary>
         TimeSpan TimeToSpend { get; set; }

        /// <summary>
        /// All the show of the user
        /// </summary>
         List<IShowUser> Shows { get; set; }

        /// <summary>
        /// Token of the user (null if the user is not log)
        /// </summary>
         string Token { get; set; }


        /* Methods */

        /// <summary>
        /// get all episodes of the member
        /// </summary>
        /// <param name="type">VO/VOVF/All</param>
        /// <param name="next">Only the next episode to watch</param>
        /// <returns>list of episode</returns>
         List<IEpisode> GetEpisodes(TypeEpisode type = TypeEpisode.All, bool next = false);

        /// <summary>
        /// If the member has watched this episode
        /// </summary>
        /// <param name="episode">episode to check</param>
        /// <returns>true if the member has already watched this episode</returns>
        bool HasWatched(IEpisode episode);
        /// <summary>
        /// If the member has watched this episode
        /// </summary>
        /// <param name="urlShow">url of the show</param>
        /// <param name="season">season of the episode</param>
        /// <param name="episode">episode number</param>
        /// <returns>true if the member has already watched this episode</returns>
        bool HasWatched(string urlShow, int season, int episode);

        /// <summary>
        /// Add a show to the member
        /// </summary>
        /// <param name="urlSerie">url of the show</param>
        void AddShow(string urlSerie);

        /// <summary>
        /// Add a show to the member
        /// </summary>
        /// <param name="show">the show</param>
        void AddShow(IShow show);

        /// <summary>
        /// remove a show from a member
        /// </summary>
        /// <param name="urlSerie">url of the show</param>
        void DelShow(string urlSerie);

        /// <summary>
        /// remove a show from a member
        /// </summary>
        /// <param name="show">the show</param>
        void DelShow(IShow show);

        /// <summary>
        /// Mark the episode as watched for the member
        /// </summary>
        /// <param name="episode">episode watched</param>
        /// <param name="note">note of the episode (default = note)</param>
        void SetWatched(IEpisode episode, int note = -1);


        /// <summary>
        /// Mark the episode as watched for the member
        /// </summary>
        /// <param name="urlShow">url of the show</param>
        /// <param name="season">season of the episode</param>
        /// <param name="episode">episode number</param>
        /// <param name="note">note of the episode (default = note)</param>
        void SetWatched(string urlShow, int season, int episode, int note = -1);

        /// <summary>
        /// Mark the episode as downloaded
        /// </summary>
        /// <param name="episode">episode downloaded</param>
        /// <param name="token">token of the member</param>
        /// <returns>if this episode is downloaded</returns>
        bool SetDownloaded(IEpisode episode);

        /// <summary>
        /// Mark the episode as downloaded for the member
        /// </summary>
        /// <param name="urlShow">url of the show</param>
        /// <param name="season">season of the episode</param>
        /// <param name="episode">episode number</param>
        /// <param name="note">note of the episode (default = note)</param>
        /// <returns>if this episode is downloaded</returns>
        bool SetDownloaded(string urlShow, int season, int episode);


        /// <summary>
        /// Destroy a token
        /// Disconnect the member
        /// </summary>
        void Destroy();

        /// <summary>
        /// allow to know if a token is still active
        /// and member still connected
        /// </summary>
        /// <returns>if the token is active</returns>
        bool IsActive();

        /// <summary>
        /// Get or update all info of an identified member
        /// </summary>
        /// <returns>The user information</returns>
        void GetInfos();

        /// <summary>
        /// get infos of a member for this authentified member 
        /// (when privacy policy = friend only for exemple)
        /// </summary>
        /// <param name="username">username of the member</param>
        /// <returns>info of the member</returns>
        IUser GetInfosOfMember(string username);


        /// <summary>
        /// Get planning of identified member
        /// </summary>
        /// <param name="unseen">show only unseen episodes</param>
        /// <returns>list of episodes</returns>
        List<IEpisode> GetPlanning(bool unseen = false);

        /// <summary>
        /// Get the username of all the friend of the member
        /// </summary>
        /// <returns></returns>
        List<string> GetFriends();

        /// <summary>
        /// Defined a mark for this episode
        /// </summary>
        /// <param name="episode">episode to mark</param>
        /// <param name="mark">mark of this episode</param>
        void SetMark(IEpisode episode, int mark);

        /// <summary>
        /// Defined a mark for this episode
        /// </summary>
        /// <param name="urlShow">url of the show</param>
        /// <param name="season">season number</param>
        /// <param name="episode">episode number</param>
        /// <param name="mark">mark of this episode</param>
        void SetMark(string urlShow, int season, int episode, int mark);

        /// <summary>
        /// Recommend this show to a friend
        /// </summary>
        /// <param name="show">Show you recommend</param>
        /// <param name="friend">friend's username</param>
        void Recommend(IShow show, string friend);
        /// <summary>
        /// Recommend this show to a friend
        /// </summary>
        /// <param name="urlShow">url of the show</param>
        /// <param name="friend">friend's username</param>
        void Recommend(string urlShow, string friend);
    }

    
}
